# -*- coding: utf-8 -*-
#
# Created with IntelliJ IDEA.
# @author  ranhongmin--2021/6/8
#
# Description: P5725 【深基4.习8】求三角形
# * 题目描述
# * 模仿例题，打印出不同方向的正方形，然后打印三角形矩阵。中间有个空行。
# * <p>
# * 输入格式
# * 输入矩阵的规模，不超过 9。
# * <p>
# * 输出格式
# * 输出矩形和正方形
# * <p>
# * 输入输出样例
# * 输入 #1复制
# * 4
# * 输出 #1复制
# * 01020304
# * 05060708
# * 09101112
# * 13141516
# * <p>
# * 01
# * 0203
# * 040506
# * 07080910
# * <p>
# * 01020304
# * 05060708
# * 09101112
# * 13141516
# * <p>
# * 01
# * 0203
# * 040506
# * 07080910
# * <p>
# * -----三角形前是两个空格 结束没有换行

inputNum = input()

num = int(inputNum) * int(inputNum)
count = 1
string = ""
while count <= int(num):
    if count < 10:
        a = "0" + str(count)
        string = string + a
        # print("0" + str(count))
    else:
        a = str(count)
        string = string + a
    if count % int(inputNum) == 0:
        print(string)
        string = ''
    count = count + 1

print()

count = 1
for i in range(0, int(inputNum), 1):
    string = ""
    for j in range(0, int(inputNum) - i-1, 1):
        string = string + "  "
        # string = string + " "
    for k in range(0, i + 1, 1):
        if count < 10:
            string = string + "0" + str(count)
        else:
            string = string + "" + str(count)
        count = count + 1
    print(string)
